package cn.com.guage.guc.juc;

import java.util.concurrent.CyclicBarrier;
public class CyclicBarrierDemo2 {

	public static void main(String[] args) {

		 CyclicBarrier cyclicBarrier = new CyclicBarrier(10,new Thread(()->{
			 System.out.println("人员到齐,公司Boss开始开会");
		 }));
		 for(int i = 0;i<10;i++) {
			 new Thread(()->{
				 try {
					System.out.println(Thread.currentThread().getName()+"到会议室");
					cyclicBarrier.await();//表示当前线程在循环栅栏外等待
				} catch (Exception e) {
					e.printStackTrace();
				} 
			 },Thread.currentThread().getName()).start();
		 }
	}
}
